package com.example.customer.config;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutExchangeConfig {

    @Bean("message")
    public Queue MessageQueue(){
        return new Queue("fanout.message");
    }

    @Bean("message22")
    public Queue MessageQueue22(){
        return new Queue("fanout.message22");
    }

    @Bean("message33")
    public Queue MessageQueue33(){
        return new Queue("fanout.message33");
    }

    @Bean("fanoutExchange")
    public FanoutExchange fanoutExchange(){
        return new FanoutExchange("fanoutExchange");
    }

    @Bean
    Binding bindingExchangeMessage(@Qualifier("message") Queue messageQueue, FanoutExchange fanoutExchange){
        return BindingBuilder.bind(messageQueue).to(fanoutExchange);
    }

    @Bean
    Binding bindingExchangeMessage2(@Qualifier("message22")Queue messageQueue22,FanoutExchange fanoutExchange){
        return BindingBuilder.bind(messageQueue22).to(fanoutExchange);
    }

    @Bean
    Binding bindingExchangeMessage3(@Qualifier("message33")Queue messageQueue33,FanoutExchange fanoutExchange){
        return BindingBuilder.bind(messageQueue33).to(fanoutExchange);
    }

}
